package com.qf.md.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.common.PageParam;
import com.qf.common.PageVO;
import com.qf.md.item.dao.MdItemDao;
import com.qf.md.item.param.ItemSearchParam;
import com.qf.md.item.service.MdItemService;
import com.qf.md.item.vo.MdItemVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zdl
 * @date 2025/3/3
 */
@Service
public class MdItemServiceImpl implements MdItemService {
    @Resource
    private MdItemDao mdItemDao;
    @Override
    public PageVO<MdItemVO> queryMdItemVo(ItemSearchParam itemSearchParam) {
        PageHelper.startPage(itemSearchParam.getPageNum(),itemSearchParam.getPageSize());
        List<MdItemVO> mdItemVOS = mdItemDao.selectMdItemVo(itemSearchParam);
        PageInfo<MdItemVO> mdItemVOPageInfo = new PageInfo<>(mdItemVOS);
        return new PageVO<>(mdItemVOPageInfo.getTotal(), mdItemVOPageInfo.getList());
    }
}
